<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text"><img src="../睁眼.png">
</body>
</html>
<script>
    var ma=document.querySelector("input")
    var yan=document.querySelector("img")
    var a=0
    yan.onclick=function(){
        if(a==0){
            yan.src='../闭眼.png'
            ma.type='password'
            a=1
        }else{
            yan.src='../睁眼.png'
            ma.type='text'
            a=0
        }
    }
</script>